import {
  Component,
  Input,
  TemplateRef,
  OnDestroy,
  OnInit,
  ViewChild,
  ChangeDetectorRef,
  AfterViewInit,
} from '@angular/core';

import { ApesGroupsComponent } from './apes-groups.component';

@Component({
  selector: 'apes-group',
  template: `
    <ng-template>
      <ng-content></ng-content>
    </ng-template>
  `,
  host: {},
})
export class ApesGroupComponent implements OnDestroy, OnInit, AfterViewInit {

  // 默认分成12份
  _col = 24;


  @Input()
  set col(value: number | null) {
    if (value) {
      this._col = value;
    }
  }


  @ViewChild(TemplateRef,{static:false}) content: TemplateRef<void>;


  constructor(private apesbox: ApesGroupsComponent, private changeref: ChangeDetectorRef) {
  }

  ngOnInit(): void {
    this.apesbox.addGroup(this);
  }

  ngOnDestroy(): void {
    this.apesbox.removeGroup(this);
  }

  ngAfterViewInit() {

  }
}
